local chuanyang = fk.CreateSkill {
  name = "lvshi__chuanyang",
  tags = { "Turn" },
}

Fk:loadTranslationTable{
  ["lvshi__chuanyang"] = "穿杨",
  [":lvshi__chuanyang"] = "回合技，其他角色于你的回合内展示或明置牌后，你可展示一张相同花色的牌，令其本回合受到的下一次伤害+1。",
  ["#lvshi__chuanyang"] = "你可以展示一张相同花色的牌，令%src本回合受到的下一次伤害+1",
  ["@@ls__chuanyang-turn"] = "穿杨",

  ["$lvshi__chuanyang1"] = "皓首曳白羽，寒光霜天下!",
  ["$lvshi__chuanyang2"] = "青冥断七杀，赤澜缚天狼!",
}

local DIY = require "packages/diy_utility/diy_utility"

chuanyang:addEffect(fk.CardShown, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(chuanyang.name) and player.room.current == player and target ~= player
    and player:usedSkillTimes(chuanyang.name) == 0
  end,
  on_cost = function(self, event, target, player, data)
    local cards = data.cardIds
    local suits = {}
    for _, id in ipairs(cards) do
      local suit = Fk:getCardById(id):getSuitString()
      table.insertIfNeed(suits, suit)
    end
    local params = {
      min_num = 1,
      max_num = 1,
      include_equip = false,
      skill_name = chuanyang.name,
      cancelable = true,
      pattern = ".|.|" .. table.concat(suits, ","),
      prompt = "#lvshi__chuanyang:" .. target.id
      }
    local showCard = player.room:askToCards(player, params)[1]
    if showCard then
      --DIY.showCards(player, showCard)
      player:showCards(showCard)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:addPlayerMark(target, "@@ls__chuanyang-turn")
  end
})

chuanyang:addEffect(fk.DamageInflicted, {
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(chuanyang.name) and target:getMark("@@ls__chuanyang-turn") > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(target, "@@ls__chuanyang-turn", 0)
    data:changeDamage(1)
  end,
})

return chuanyang